f71066d5d32523ac45cf4600b03282594b5cbfc9,opennms-webapp/src/main/java/org/opennms/web/controller/ksc/FormProcReportController.java,FormProcReportController,handleRequestInternal,#HttpServletRequest#HttpServletResponse#,54

Before Change


        } else {
            if (action.equals("AddGraph") || action.equals("ModGraph")) {
                // Making a graph change... load it into the working area (the graph_index of -1 indicates a new graph)
                getKscReportFactory().loadWorkingGraph(graph_index);
            } else {
                if (action.equals("DelGraph")) { 
                    report.removeGraph(report.getGraph(graph_index));

After Change



    @Override
    protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
        KscReportEditor editor = KscReportEditor.getFromSession(request.getSession(), true);
        
        // Get The Customizable Report 
        Report report = editor.getWorkingReport();

        // Get Form Variables
        String action = request.getParameter("action");
        String report_title = request.getParameter("report_title");
        String show_timespan = request.getParameter("show_timespan");
        String show_graphtype = request.getParameter("show_graphtype");
        String g_index = request.getParameter("graph_index");
        int graph_index = WebSecurityUtils.safeParseInt(g_index);
        int graphs_per_line = WebSecurityUtils.safeParseInt(request.getParameter("graphs_per_line"));
     
        // Save the global variables into the working report
        report.setTitle(report_title);
        if (show_graphtype == null) {
            report.setShow_graphtype_button(false);
        } else {
            report.setShow_graphtype_button(true);
        }
        
        if (show_timespan == null) {
            report.setShow_timespan_button(false);
        } else {
            report.setShow_timespan_button(true);
        } 
        
        if (graphs_per_line > 0) {
            report.setGraphs_per_line(graphs_per_line);
        } else {
            report.setGraphs_per_line(0);
        } 

        if (action.equals("Save")) {
            // The working model is complete now... lets save working model to configuration file 
            try {
                editor.unloadWorkingReport(getKscReportFactory());  // first copy working report into report arrays
                getKscReportFactory().saveCurrent();          // Now unmarshal array to file
            } catch (Exception e) {
                throw new ServletException("Couldn't save KSC_PerformanceReportFactory.", e);
            }
        } else {
            if (action.equals("AddGraph") || action.equals("ModGraph")) {
                // Making a graph change... load it into the working area (the graph_index of -1 indicates a new graph)
                editor.loadWorkingGraph(graph_index);
            } else {
                if (action.equals("DelGraph")) { 
                    report.removeGraph(report.getGraph(graph_index));
                } else {
                    throw new ServletException("Invalid Argument for Customize Form Action.");
                }
            }
        }
        
        if (action.equals("Save")) {
            return new ModelAndView("redirect:/KSC/index.htm");
        } else if (action.equals("DelGraph")) {
            return new ModelAndView("redirect:/KSC/customReport.htm");
        } else if (action.equals("AddGraph")) {
            return new ModelAndView("redirect:/KSC/customGraphChooseParentResource.htm");
        } else if (action.equals("ModGraph")) {
            Graph graph = editor.getWorkingGraph();
            OnmsResource resource = getKscReportService().getResourceFromGraph(graph);
            return new ModelAndView("redirect:/KSC/customGraphEditDetails.htm", "resourceId", resource.getId());
        } else {